package org.flowcircuit.model.coordinates

/**
 * 
 * 
 * @author Hans Haggstrom
 */

case class Pos( x : Float, y : Float ) {

  def + ( otherPos : Pos ) : Pos = Pos( x + otherPos.x, y + otherPos.y )

  def squaredDistance( other : Pos ) : Float = {
    val dx = x - other.x
    val dy = y - other.y
    dx * dx + dy * dy
  }

  def distance( other : Pos ) : Float = Math.sqrt( squaredDistance( other ).toDouble ).toFloat
}